import request from '@/utils/request'

// 创建设备报修
export function createFault(data) {
  return request({
    url: '/device/fault/create',
    method: 'post',
    data: data
  })
}

// 更新设备报修
export function updateFault(data) {
  return request({
    url: '/device/fault/update',
    method: 'put',
    data: data
  })
}

// 接受设备报修
export function acceptFault(id) {
  return request({
    url: '/device/fault/accept?id=' + id,
    method: 'put'
  })
}

// 确认设备报修
export function confirmFault(id) {
  return request({
    url: '/device/fault/confirm?id=' + id,
    method: 'put'
  })
}

// 删除设备报修
export function deleteFault(id) {
  return request({
    url: '/device/fault/delete?id=' + id,
    method: 'delete'
  })
}

// 获得设备报修
export function getFault(id) {
  return request({
    url: '/device/fault/get?id=' + id,
    method: 'get'
  })
}

// 获得设备报修分页
export function getFaultPage(query) {
  return request({
    url: '/device/fault/page',
    method: 'get',
    params: query
  })
}

// 导出设备报修 Excel
export function exportFaultExcel(query) {
  return request({
    url: '/device/fault/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}
